/**
 * 菜单快捷访问自定义字段
 * 
 * @author 艾格林门信息服务（大连）有限公司
 * @copyright 2015 - present
 * @license GPL v3
 */
PCL.define("PSI.MainMenu.Shortcut.Picker", {
  extend: "Ext.container.Container",

  /**
   * @override
   */
  initComponent() {
    const me = this;

    PCL.apply(me, {
      height: 400,
      width: 750,
      layout: "fit",
      items: [
        me.getMainGrid()
      ]
    });

    me.callParent(arguments);
  },

  getMainGrid() {
    const me = this;
    if (me._mainGrid) {
      return me._mainGrid;
    }

    const modelName = "PSIModel.PSI.MainMenu.Shortcut.Field";
    PCL.define(modelName, {
      extend: "PCL.data.Model",
      fields: ["id", "fid", "caption", "py", "code"]
    });

    const store = PCL.create("PCL.data.Store", {
      model: modelName,
      autoLoad: false,
      data: []
    });
    me._mainGrid = PCL.create("PCL.grid.Panel", {
      cls: "PSI-Lookup",
      columnLines: true,
      border: 1,
      store: store,
      columns: [{
        header: "助记码",
        dataIndex: "py",
        menuDisabled: true,
        width: 100
      }, {
        header: "编码",
        dataIndex: "code",
        menuDisabled: true,
        width: 100
      }, {
        header: "菜单",
        dataIndex: "caption",
        menuDisabled: true,
        flex: 1
      }]
    });

    return me._mainGrid;
  }
});
